package com.mengfou;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 梦否
 * @date 2025/07/05 12:04
 */
public class LogProxy {

    private ClassLoader classLoader;
    private List<String> messages = new ArrayList<>();

    public LogProxy(ClassLoader cls) {
        this.classLoader = cls;
        messages.add("has message");
    }

    private boolean hotFix;

    public void error(String tag, String s) {
        if(hotFix) {
            HotFixHelper.hotFix(this, "error", tag, s,  this.classLoader);
            return;
        }
        System.out.println(tag + ": " + s);
    }

    public void hotFix(boolean b) {
        hotFix = b;
    }

    public void printMessageSize() {
        System.out.println("message size: " + messages.size());
    }
}
